
import { Chart, registerables } from 'chart.js';
Chart.register(...registerables);

export default {
	data() {
		return {
			activeTab: 0,
			tabsList: [
				{ name: '热门' },
				{ name: '涨幅榜' },
				{ name: '跌幅榜' },
				{ name: '新币榜' },
				{ name: '成交榜' },
			],
			selectedCoins: [],
			coins: [
				[
					{ symbol: 'BTC', price: 'USDT' },
					{ symbol: 'ETH', price: 'USDT' },
				],
				[
					{ symbol: 'BGB', price: 'USDT' },
					{ symbol: 'XRP', price: 'USDT' },
				],
				// 其他组...
			],
			customCoins: [
				{ symbol: 'BTC', price: 'USDT' },
				{ symbol: 'ETH', price: 'USDT' },
				// ... 其他自选币种
			],
			followProducts: [],
			functionIcons: [
				{ icon: 'gift-fill', text: '福利中心' },
				{ icon: 'account-fill', text: '邀请好友' },
				{ icon: 'star-fill', text: 'BGSOL' },
				{ icon: 'server-fill', text: 'Launchpool' },
				{ icon: 'more-circle', text: '更多' },
			],
			largeAds: [
				{
					title: '"合约交易大亨"招募',
					subtitle: '入驻Bitget',
					highlight: '畅饮',
					highlightEmphasis: '《大亨》',
					highlightEnd: '不限量',
					image: '/static/image/home_3.png'
				},
				// ... 可以添加更多大广告项
			],
			smallAds: [
				{
					label: '链上赚币',
					logo: '/static/logo.png',
					name: 'ETH',
					rate: '4.00% APR'
				},
				// ... 可以添加更多小广告项
			],
			currentLargeAd: 1,
			currentSmallAd: 1,
			newsItems: [
				'25%返佣特开启! Bitget 卓越邀请人项目来袭!',
				// 添加更多新闻项...
			]
		}
	},
	onLoad() {
		this.followProducts = [
			{ name: 'BGSOL', logo: '/static/logo.png', level: '1', fnum: '100', ftotal: '1000', rate: '20%', increase: '100%', list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] },
			{ name: 'BGSOL', logo: '/static/logo.png', level: '2', fnum: '200', ftotal: '2000', rate: '20%', increase: '100%', list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] },
		]
	},
	methods: {
		onLargeAdChange(e) {
			this.currentLargeAd = e.detail.current + 1;
		},
		onSmallAdChange(e) {
			this.currentSmallAd = e.detail.current + 1;
		},
		onTabChange(index) {
			this.activeTab = index; // 更当前选中的标签
		},
		renderChart(index) {
			console.log(this.$refs);
			const ctx = this.$refs['chart-' + index].getContext('2d');

			new Chart(ctx, {
				type: 'line',
				data: {
					labels: ['1', '2', '3', '4', '5'], // 替换为您的数据标签
					datasets: [{
						label: '数据标签',
						data: [0, 10, 5, 2, 20], // 替换为您的数据
						borderColor: 'rgba(0, 123, 255, 1)',
						backgroundColor: 'rgba(0, 123, 255, 0.2)',
						fill: true,
					}]
				},
				options: {
					responsive: true,
					scales: {
						x: {
							beginAtZero: true
						},
						y: {
							beginAtZero: true
						}
					}
				}
			});
		}
	}
	// ... 其他方法和生命周期钩子
}